package com.cyzy.server.controller.user;


import com.cyzy.common.result.Result;
import com.cyzy.pojo.dto.HuntCardDTO;
import com.cyzy.pojo.dto.HuntCardUpdateDTO;
import com.cyzy.pojo.dto.RecruitCardDTO;
import com.cyzy.pojo.entity.HuntCard;
import com.cyzy.pojo.entity.RecruitCard;
import com.cyzy.pojo.vo.HuntCardVO;
import com.cyzy.pojo.vo.RecruitCardVO;
import com.cyzy.server.dao.HuntCardDao;
import com.cyzy.server.dao.RecruitCardDao;
import com.cyzy.server.service.HuntCardService;
import com.cyzy.server.service.RecruitCardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user/card/publish")
@Slf4j
public class PublishController {


    @Autowired
    private RecruitCardService recruitCardService;

    @Autowired
    private RecruitCardDao recruitCardDao;

    @Autowired
    private HuntCardService huntCardService;

    @Autowired
    private HuntCardDao huntCardDao;

    @PostMapping("/recruit")
    public Result publishRecruitCard(@RequestBody RecruitCardDTO recruitCardDTO) {
        log.info("发布招募帖子...");

        RecruitCard recruitCard = recruitCardService.save(recruitCardDTO);

        return Result.success(recruitCard, "发布成功");
    }

    @PostMapping("/job")
    public Result publishHuntCard(@RequestBody HuntCardDTO huntCardDTO) {
        log.info("发布求职帖子...");

        HuntCard huntCard = huntCardService.save(huntCardDTO);

        return Result.success(huntCard, "发布成功");
    }


}
